﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace VFTray.Mi
{
	class RSAHelper
	{
        internal static bool Verify(byte[] need_verified_data, byte[] signed_data, string pub_key)
        {
            try
            {
                RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
                rsa.FromXmlString(pub_key);
                bool rtn = rsa.VerifyData(need_verified_data, new SHA1CryptoServiceProvider(), signed_data);
                return rtn;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                return false;
            }
        }
    }
}
